<script setup>
import { userStore } from "~/composables/useUserStore";
const store = userStore()
const state = reactive({
    circleUrl:
        'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png'
})
const { circleUrl } = toRefs(state)
const { userInfo } = toRefs(store)
</script>

<template>
    <section class="boxCon rightLoginCon">
        <img src="~/assets/resources/index/loginBg.png" class="loginBg" alt="">



        <div class="textCon">
            <div v-if="!store.isLogin" class="text">
                登录并开始上传，让您的
                每一个资源都能转化为收益！
            </div>
            <div v-if="store.isLogin" class="avatar">
                <div class="avatarCenter">
                    <img class="user_avatar" v-if="store.token.imageUrl && store.token.imageUrl != ''"
                        :src="store.token.imageUrl" />
                    <div v-else class="header_avatar user_avatar">{{ store.token && store.token.nickName ?
                        store.token.nickName.slice(0, 1) : '' }}</div>
                </div>

                <div class="nickName">
                    {{ store.token.nickName }}
                </div>
            </div>
        </div>

        <div class="btnCon">
            <div v-if="!store.isLogin" class="loginBtn">
                <button class="btn" @click="store.visiable = true">立即登录</button>
            </div>

            <div v-if="store.isLogin" class="info">
                <div class="item">
                    <h2 class="num">{{ userInfo.data.tapNum || 0 }}</h2>
                    <p class="text">浏览量</p>
                </div>
                <div class="line"></div>
                <div class="item">
                    <h2 class="num">{{ userInfo.data.assetsNum || 0 }}</h2>
                    <p class="text">文章</p>
                </div>
            </div>
        </div>


    </section>
</template>

<style scoped lang="scss">
h1,h2,p{
    margin: 0;
}
.boxCon {
    height: 298px;
    border-radius: 10px;
    border: 1px solid #FFFFFF;
    position: relative;
    background: linear-gradient(180deg, #D5EDFF 0%, #FFFFFF 100%);

    .loginBg {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 0;
    }

    .textCon {
        padding: 60px 30px 0 30px;
        text-align: center;
        position: relative;
        z-index: 2;

        .text {
            font-size: 18px;
            color: #4D8EFF;
        }

        .avatar {
            font-size: 28px;
            color: #333333;
            font-weight: 500;

            .avatarCenter {
                display: flex;
                justify-content: center;
                margin-bottom: 10px
            }

            .header_avatar {
                position: relative;
                line-height: 35px;
                text-align: center;
                background: #1684fc;
                color: #fff;
            }

            .user_avatar {
                border-radius: 50%;
                width: 60px;
                height: 60px;
                font-size: 16px;
                line-height: 60px;
            }

            .nickName {
                font-size: 28px;
                color: #333333;
                font-weight: 500;
            }
        }
    }

    .btnCon {
        position: absolute;
        bottom: 40px;
        left: 50%;
        z-index: 2;
        transform: translateX(-50%);
        width: 100%;

        .loginBtn {
            display: flex;
            justify-content: center;
        }

        .btn {
            border: none;
            cursor: pointer;
            display: flex;
            justify-content: center;
            align-items: center;
            width: 230px;
            height: 36px;
            background: linear-gradient(94deg, #488BFF 0%, #9ABEFF 100%);
            box-shadow: 0px 3px 6px 1px #96BBFF;
            border-radius: 24px 24px 24px 24px;
            color: #ffffff;
        }

        .info {
            display: flex;
            justify-content: center;
            align-items: center;

            .line {
                height: 45px;
                width: 1px;
                background-color: #E5E5E5;
            }

            .item {
                text-align: center;
                // padding: 0 36px;
                width: 120px;
            }

            .num {
                font-weight: 400;
                font-size: 26px;
                color: #333333;
            }

            .text {
                font-size: 16px;
                color: #999999;
            }
        }
    }

}
</style>
